package com.android;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;

public class GreenPage extends Activity implements OnCheckedChangeListener {

	TextView textOut;
	EditText editTxt;
	RadioGroup Gravityunit;
	RadioGroup StyleGunit;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.greenpage);

		Gravityunit = (RadioGroup) findViewById(R.id.rgGravity);
		Gravityunit.setOnCheckedChangeListener(this);

		StyleGunit = (RadioGroup) findViewById(R.id.rgStyle);
		StyleGunit.setOnCheckedChangeListener(this);

		textOut = (TextView) findViewById(R.id.tvGetInput);
		editTxt = (EditText) findViewById(R.id.etInput);
		Button ok = (Button) findViewById(R.id.btnOK);

		ok.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				textOut.setText(editTxt.getText());
			}
		});

	}

	@Override
	public void onCheckedChanged(RadioGroup group, int checkedId) {
		// TODO Auto-generated method stub
		switch (checkedId) {
		case R.id.rbLeft:
			textOut.setGravity(Gravity.LEFT);
			break;
		case R.id.rbCenter:
			textOut.setGravity(Gravity.CENTER);
			break;
		case R.id.rbRight:
			textOut.setGravity(Gravity.RIGHT);
			break;
		case R.id.rbNormal:
			textOut.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL),
					Typeface.NORMAL);
			break;
		case R.id.rbBold:
			textOut.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD),
					Typeface.BOLD);
			break;
		case R.id.rbItalics:
			textOut.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC),
					Typeface.ITALIC);
			break;
		default:
			break;
		}
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();

	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
	}

}